#!/bin/bash
SERVICE_NAME=jenkins-docker

#切换到jenkins 工作区间
echo  "change folder to jenkins workspace"
cd /var/jenkins_home/workspace/jenkins-docker/target
#复制文件
echo "copy jar to dockerFile folder "
mv /var/jenkins_home/workspace/jenkins-docker/target/jenkins-docker-0.0.1-SNAPSHOT.jar /var/jenkins_home/workspace/jenkins-docker/dockerFile/jenkins-docker-0.0.1-SNAPSHOT.jar
#修改权限
echo " update  jar permission "
chmod 777 /var/jenkins_home/workspace/jenkins-docker/dockerFile/jenkins-docker-0.0.1-SNAPSHOT.jar
#docker 打包
echo "docker build"
docker build -t jenkins-docker .
docker tag jenkins-docker:latest docker.io/qkkspace/jenkins-docker:0.1
echo  "docker login"
docker login -u qkkspace -p qkkspace39
docker push docker.io/qkkspace/jenkins-docker:0.1

